﻿using AutoMapper;
using Testudo.Core;

namespace Testudo.Mongo;

internal static class PagingListExtensions
{
    public static PagingList<TVM> PagingListMap<TEntity, TVM>(this PagingList<TEntity> target, IMapper mapper)
    {
        return new PagingList<TVM>
        {
            PageIndex = target.PageIndex,
            PageSize = target.PageSize,
            TotalCount = target.TotalCount,
            Data = target.Data.Select(a => mapper.Map<TVM>(a)).ToList()
        };
    }
}